<link type="text/css" href="/admins/js/pagerView/pager-view.css" rel="stylesheet" />
<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/jquery/jquery-ui-1.8.20.custom.min.js"></script>
<script type="text/javascript" src="/admins/js/jquery/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="/admins/js/pagerView/pager-view.js"></script>
<script type="text/javascript">
    $(function(){
    
        $.datepicker.setDefaults( $.datepicker.regional[ "zh-CN" ] );
        $( "#solveDate" ).datepicker({
            changeMonth: true,
            changeYear: true
        });
    });
</script>
<style>
    #ingboy{
        font-size: 16px;
        float: left;
    }
    #houtai_overlay{
        font-size: 16px;
        float: left;
    }
    #storedetail{
        line-height: 36px;
        padding-left: 20px;
        padding-bottom: 10px;
    }
    #editdetail{
        line-height: 36px;
        padding-left: 20px;
        padding-bottom: 10px;
    }
     #editdetail input{
        width: 80%;
        height: 20px;
        font-size: 16px;
        padding: 2px;
    }
    #editdetail select{
        width: 146px;
        height: 30px;
        font-size: 16px;
        padding: 2px;
    }
    #bf{
        background-color: #eee;
        text-align: right;
        width: 150px;
    }
    #cf{
        width: 200px;
        padding: 5px;
    }
</style>
<?php
if($this->ma == 1){
    echo '<script language="javascript" type="text/javascript">alert("客服记录修改成功！");location.href = "/admini/manageday/servicedetail/id/'.$this->serviceItem->Id.'"; </script>';
}else if($this->ma == 2){
    echo '<script language="javascript" type="text/javascript">alert("客服记录修改失败，请重新操作！");</script>';
}else if($this->ma == 3){
    echo '<script language="javascript" type="text/javascript">alert("发生未知错误，请重新操作！");location.href = "/admini/manageday/servicelog/";</script>';
}
?>
<div id="ingboy">
    <div id='storedetail'>
        客服记录信息
        <table width="720" border="1" cellpadding="0" cellspacing="0">
            <tr>
                  <td id='bf'>客户名称：</td>
                  <td id='cf' valign="middle"><?php echo $this->serviceItem->UserName;?></td>
                  <td id='bf'>仓库号：</td>
                  <td id='cf' valign="middle"><?php echo $this->serviceItem->StoreNo;?></td>
                </tr>
                <tr>
                  <td id='bf'>客户QQ：</td>
                  <td id='cf' valign="middle"><?php echo $this->serviceItem->Qq;?></td>
                  <td id='bf'>客户所在地：</td>
                  <td id='cf' valign="middle" ><?php echo $this->serviceItem->StateName;?></td>
                </tr>
                <tr>
                  <td id='bf'>客户类型：</td>
                  <td id='cf' valign="middle"><?php echo $this->serviceItem->UserTypeName;?></td>
                  <td id='bf'>接待客服：</td>
                  <td id='cf' valign="middle"><?php echo $this->serviceItem->serName;?></td>
                </tr>
                <tr>
                  <td id='bf'>内容类型：</td>
                  <td id='cf' valign="middle"><?php echo $this->serviceItem->FirstTypeName;?></td>
                  <td id='bf'>功能类型：</td>
                  <td id='cf' valign="middle"><?php echo $this->serviceItem->FunctionTypeName;?></td>
                </tr>
                <tr>
                  <td id='bf'>紧急类型：</td>
                  <td id='cf' colspan="3"  valign="middle"><?php echo $this->serviceItem->UrgencyTypeName;?></td>
                </tr>
                <tr>
                  <td id='bf'>内容：</td>
                  <td id='cf' colspan="3" valign="middle"><?php echo $this->serviceItem->Content;?></td>
                </tr>
                <?php if($this->serviceItem->Status == Application_Model_Service::Status_DisposeIng || $this->serviceItem->Status == Application_Model_Service::Status_OutDispose || $this->serviceItem->Status == Application_Model_Service::Status_Processed){ ?>
                    <tr>
                        <td id='bf'>处理人：</td>
                        <td id='cf' valign="middle"><?php echo $this->serviceItem->SolveName;?></td>
                        <td id='bf'>预计处理时间：</td>
                        <td id='cf' valign="middle"><?php echo $this->serviceItem->solveDate;?></td>
                    </tr>
                    <tr>
                      <td id='bf'>处理方案：</td>
                      <td id='cf' colspan="3" valign="middle"><?php echo $this->serviceItem->SolveScheme;?></td>
                    </tr>
                <?php } ?>
                <tr>
                    <td id='cf' colspan="4" align="center" height="37px">
                            <?php if($this->serviceItem->Operator == Uuch_Util::getUserNikeName()){?>
                                &nbsp;&nbsp;<input type="button" id="editbacklog" naem="editbacklog" value="修改" style="background-color: #1668A4;width: 50px;height: 36px;color: white;font-size: 16px;border-radius:8px;"/>
                                &nbsp;&nbsp;<input type="button" id="delserlog" naem="delserlog" value="删除" style="background-color: #1668A4;width: 50px;height: 36px;color: white;font-size: 16px;border-radius:8px;"/> 
                            <?php } ?>
                        &nbsp;&nbsp;<input type="button" id="refo" naem="refo" value="返回" style="background-color: #1668A4;width: 50px;height: 36px;color: white;font-size: 16px;border-radius:8px;"/>
                    </td>
              </tr>
          </table>
    </div>
</div>
<?php if($this->serviceItem->Operator == Uuch_Util::getUserNikeName() && $this->serviceItem->Status != Application_Model_Service::Status_Processed){?>
<div id="houtai_overlay" style="display:none;">
    <div id='editdetail'>
        修改客服记录信息
        <form action="/admini/manageday/servicedetail/id/<?php echo $this->serviceItem->Id;?>" method="post">
            <table width="100%" border="1" cellpadding="0" cellspacing="0">  
                <tr>
                  <td id='bf'>客户名称：</td>
                  <td id='cf' valign="middle">&nbsp;&nbsp;<input type="text" id="userName" name="userName" value="<?php echo $this->serviceItem->UserName;?>" /></td>
                  <td id='bf'>仓库号：</td>
                  <td id='cf' valign="middle">&nbsp;&nbsp;<input type="text" name="storeNo" id="storeNo"  value="<?php echo $this->serviceItem->StoreNo;?>"/></td>
                </tr>
                <tr>
                  <td id='bf'>客户QQ：</td>
                  <td id='cf' valign="middle">&nbsp;&nbsp;<input type="text" name="qq" id="qq" value="<?php echo $this->serviceItem->Qq;?>"/></td>
                  <td id='bf'>客户所在地：</td>
                  <td id='cf' valign="middle" ><input type="hidden" name="state" id="state" value="<?php echo $this->serviceItem->State;?>"/>
                      <div style="position: relative;" id="state_div">
                        <div class="guyojiatext">&nbsp;&nbsp;<?= $this->formText('cityName',$this->serviceItem->StateName,array('readonly'=>true,'cid'=>$this->serviceItem->State)) ?><a href="javascript:void(0)"></a></div>
                        <div class="guojiaceng" style="display:none;top:33px;">
                            <div class="remen">
                                <h2>热门国家和地区</h2>
                                <ul class="countrylist">
                                    <li><a href="javascript:void(0)" id="c_us" cid="1">美国</a></li>
                                    <li><a href="javascript:void(0)" cid="2">加拿大</a></li>
                                    <li><a href="javascript:void(0)" cid="3">澳大利亚</a></li>
                                    <li><a href="javascript:void(0)" cid="47">日本</a></li>
                                    <li><a href="javascript:void(0)" cid="39">台湾</a></li>
                                    <li><a href="javascript:void(0)" cid="4">新西兰</a></li>
                                    <li><a href="javascript:void(0)" cid="5">英国</a></li>
                                    <li><a href="javascript:void(0)" cid="42">马来西亚</a></li>
                                </ul>
                            </div>
                            <div class="allcountry">
                                <h2>全部国家和地区</h2>
                                <ul class="countryzm">
                                    <? foreach ($this->words as $char) { ?>
                                        <li <?= $char == 'A' ? 'class="zmon"' : '' ?>><a href="javascript:void(0)"><?= $char ?></a></li>
                                    <? } ?>
                                </ul>
                                <div id="countryTab">
                                    <? foreach ($this->words as $char) { ?>
                                        <ul class="countrylist"  <?= $char == 'A' ? '' : 'style="display:none"' ?>>
                                            <?
                                            $citys = Application_Model_city::GetBySortCode($char);
                                            foreach ($citys as $city) {
                                                ?>
                                                <li><a href="javascript:void(0)" cid="<?= $city->Id ?>"><?= $city->Name ?></a></li>
                                        <? } ?>
                                        </ul>
                                   <? } ?>
                                </div>
                            </div>
                        </div>
                      </div>
                  </td>
                </tr>
                <tr>
                  <td id='bf'>客户类型：</td>
                  <td id='cf' valign="middle">&nbsp;
                    <select id="userType" name="userType">
                        <?php foreach ($this->userTypeAll as $key => $userTypeVal) { ?>
                            <option value="<?php echo $key;?>" <?php echo $this->serviceItem->UserType == $key?"selected":"";?>><?php echo $userTypeVal;?></option>
                        <?php }?>
                    </select></td>
                  <td id='bf'>接待客服：</td>
                  <td id='cf' valign="middle">&nbsp;&nbsp;<input type="text" name="serName" id="serName"  value="<?php echo $this->serviceItem->serName;?>"/></td>
                </tr>
                <tr>
                  <td id='bf'>内容类型：</td>
                  <td id='cf' valign="middle">&nbsp;
                    <select id="firstType" name="firstType">
                        <?php foreach ($this->firstTypeAll as $key => $firstTypeVal) { ?>
                            <option value="<?php echo $key;?>" <?php echo $this->serviceItem->FirstType == $key?"selected":"";?>><?php echo $firstTypeVal;?></option>
                        <?php }?>
                    </select></td>
                  <td id='bf'>功能类型：</td>
                  <td id='cf' valign="middle">&nbsp;
                    <select id="functionType" name="functionType">
                        <?php foreach ($this->functionTypeAll as $key => $functionTypeVal) { ?>
                            <option value="<?php echo $key;?>" <?php echo $this->serviceItem->FunctionType == $key?"selected":"";?>><?php echo $functionTypeVal;?></option>
                        <?php }?>
                    </select></td>
                </tr>
                <tr>
                  <td id='bf'>紧急类型：</td>
                  <td id='cf' valign="middle" colspan="3">&nbsp;
                    <select id="urgencyType" name="urgencyType">
                        <?php foreach ($this->urgencyTypeAll as $key => $urgencyTypeVal) { ?>
                            <option value="<?php echo $key;?>" <?php echo $this->serviceItem->UrgencyType == $key?"selected":"";?>><?php echo $urgencyTypeVal;?></option>
                        <?php }?>
                    </select></td>
                </tr>
                <tr>
                  <td id='bf' style="height:250px;">内容：</td>
                  <td id='cf' colspan="3" valign="middle">&nbsp;&nbsp;<textarea name="content" id="content"  cols="99" rows="12" style="font-size:16px;resize:none;"><?php echo str_replace("<br />","",nl2br($this->serviceItem->Content));?></textarea></td>
                </tr>
                <tr>
                    <td id='cf' colspan="4" align="right">
                        <input type="hidden" id="id" name="id" value="<?php echo $this->serviceItem->Id;?>" />
                        <input type="hidden" id="operate" name="operate" value="editserlog" />
                        <input type="submit" id="submit" name="submit" value="确认修改" style="background-color: #F60;width: 80px;height: 36px;color: white;font-size: 16px;border-radius:8px;" />&nbsp;&nbsp;
                        <input type="button" id="re_button" name="re_button" value="返回" style="background-color: #1668A4;width: 50px;height: 36px;color: white;font-size: 16px;border-radius:8px;" />&nbsp;&nbsp;</td>
                </tr>
              </table>
          </form>
    </div>
</div>
<?php } ?>

<script type="text/javascript">
    $("#refo").click(function(){
        history.back();
    });
    $("#delserlog").live("click",function(){
       var serviceId = $("#id").val();
       if(confirm("您确定删除该客服记录？","提示信息")){   
            $.ajax({
                 type: 'POST',
                 url: '/admini/manageday/delserlog/id/'+serviceId,
                 success: function(data) {
                     if(data == 1){
                         alert("删除成功！");
                         location.href = "/admini/manageday/servicelog/";
                     }
                 }
               });
       }
    });
    $('#submit').click(function(){
        var qq = $('#qq').val();
        var sername = $('#sername').val();
        var content = $('#content').val();
        if(qq == ''){
            alert("客户QQ不能为空！");
            return false;
        }else if(sername == ''){
            alert("客服名称不能为空！");
            return false;
        }else if(content == ''){
            alert("信息内容不能为空！");
            return false;
        }else{
            return true;
        }
    });
    $("#editbacklog").click(function(){
        $("div#ingboy").hide();
        $("div#houtai_overlay").show();
    });
    $("#re_button").click(function(){
        $("div#ingboy").show();
        $("div#houtai_overlay").hide();
    });
    $('#state_div').hover(function(){
    },function(){
        $('.guojiaceng').hide();
    }).click(function(){
        $('.guojiaceng').show();
    });
    $('.countrylist a').bind('click',function(){
        var city =$(this).text();
        var state = $(this).attr("cid");
        $("#state").val(state);
        $("#cityName").val(city);
        $('.guojiaceng').hide();
        return false;
    });
    $('.countryzm a').each(function(index,item){
        $(item).click(function(){
            $('.countryzm li.zmon').removeClass('zmon');
            $(this).parent().addClass('zmon');
            $('#countryTab ul').hide();
            $('#countryTab ul').eq(index).show();
            return false;
        });
    });
</script>